{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Visualizing and Analyzing Jigsaw" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import re\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the previous section, we explored how to generate topics from a textual dataset using LDA. But how can this be used as an application? \n", "\n", "Therefore, in this section, we will look into the possible ways to read the topics as well as understand how it can be used." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will now import the preloaded data of the LDA result that was achieved in the previous section. " ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv(\"https://raw.githubusercontent.com/dudaspm/LDA_Bias_Data/main/topics.csv\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Unnamed: 0 | \n", "Topic 0 words | \n", "Topic 0 weights | \n", "Topic 1 words | \n", "Topic 1 weights | \n", "Topic 2 words | \n", "Topic 2 weights | \n", "Topic 3 words | \n", "Topic 3 weights | \n", "Topic 4 words | \n", "... | \n", "Topic 5 words | \n", "Topic 5 weights | \n", "Topic 6 words | \n", "Topic 6 weights | \n", "Topic 7 words | \n", "Topic 7 weights | \n", "Topic 8 words | \n", "Topic 8 weights | \n", "Topic 9 words | \n", "Topic 9 weights | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0 | \n", "trump | \n", "3452.3 | \n", "mental | \n", "3351.9 | \n", "canada | \n", "591.5 | \n", "mental | \n", "1186.5 | \n", "gun | \n", "... | \n", "school | \n", "840.5 | \n", "mental | \n", "1058.1 | \n", "white | \n", "1220.1 | \n", "mental | \n", "1836.1 | \n", "god | \n", "954.9 | \n", "
1 | \n", "1 | \n", "presid | \n", "1031.5 | \n", "ill | \n", "1993.1 | \n", "muslim | \n", "582.0 | \n", "peopl | \n", "708.3 | \n", "mental | \n", "... | \n", "kid | \n", "723.0 | \n", "comment | \n", "848.3 | \n", "peopl | \n", "1076.2 | \n", "peopl | \n", "1793.0 | \n", "one | \n", "934.0 | \n", "
2 | \n", "2 | \n", "vote | \n", "813.8 | \n", "health | \n", "1213.7 | \n", "countri | \n", "539.3 | \n", "drug | \n", "555.8 | \n", "peopl | \n", "... | \n", "year | \n", "590.5 | \n", "like | \n", "678.6 | \n", "black | \n", "651.0 | \n", "health | \n", "1464.6 | \n", "women | \n", "905.2 | \n", "
3 | \n", "3 | \n", "like | \n", "780.9 | \n", "medic | \n", "706.8 | \n", "us | \n", "519.8 | \n", "ill | \n", "538.9 | \n", "law | \n", "... | \n", "go | \n", "514.7 | \n", "would | \n", "668.2 | \n", "disord | \n", "537.1 | \n", "homeless | \n", "1367.5 | \n", "life | \n", "830.1 | \n", "
4 | \n", "4 | \n", "elect | \n", "579.5 | \n", "http | \n", "630.5 | \n", "world | \n", "490.3 | \n", "health | \n", "497.7 | \n", "kill | \n", "... | \n", "time | \n", "507.9 | \n", "think | \n", "650.4 | \n", "person | \n", "529.5 | \n", "care | \n", "1296.8 | \n", "peopl | \n", "798.2 | \n", "
5 rows × 21 columns
\n", "